<template>
    <van-row>
        <van-col :span="24">

            <van-address-edit
                :area-list="areaList"
                show-delete
                show-set-default
                show-search-result
                :search-result="searchResult"
                :area-columns-placeholder="['请选择', '请选择', '请选择']"
                @save="onSave"
                @delete="onDelete"
                @change-detail="onChangeDetail"
                />

        </van-col>
    </van-row>
</template>

<script setup>
import { ref,onMounted } from "vue";
import { areaList } from '@vant/area-data';

const searchResult = ref([]);

const onSave = (addressEditInfo) => {
    console.log('save---',addressEditInfo);
    let address = {
        contactName: addressEditInfo.name,
        contactTel: addressEditInfo.tel,
        address: addressEditInfo.province+addressEditInfo.city+addressEditInfo.county+addressEditInfo.addressDetail,
        userId: userId.value
    }

    

};
const onDelete = () => showToast('delete');
// const onChangeDetail = (val) => {
//   if (val) {
//     searchResult.value = [
//       {
//         name: '河南师范大学(平原湖校区)',
//         address: '河南省新乡市经七路纬七路',
//       },
//     ];
//   } else {
//     searchResult.value = [];
//   }
// };

   const userId = ref(null);

   onMounted(()=>{

        userId.value = 1;


   })
</script>

<style>
</style>